<template>
  <div class="page-cont">
    <div class="input-group">
        <div>
            <p>当前课程</p>
            <a-input v-model:value="lesson"></a-input>
        </div>
        <div>
            <p>当前项目</p>
            <a-input v-model:value="project"></a-input>
        </div>
        <div>
            <p>当前任务</p>
            <a-input v-model:value="mission"></a-input>
        </div>
    </div>
    <div class="input-group">
        <div>
            <p>温度阈值</p>
            <a-input v-model:value="sensorThes.temp"></a-input>
        </div>
        <div>
            <p>湿度阈值</p>
            <a-input v-model:value="sensorThes.humi"></a-input>
        </div>
        <div>
            <p>PM2.5阈值</p>
            <a-input v-model:value="sensorThes.pm25"></a-input>
        </div>
    </div>
    <div class="input-group">
        <div>
            <p>VOC阈值</p>
            <a-input v-model:value="sensorThes.voc"></a-input>
        </div>
        <div>
            <p>压力阈值</p>
            <a-input v-model:value="sensorThes.pressure"></a-input>
        </div>
        <div>
            <p>氧气阈值</p>
            <a-input v-model:value="sensorThes.oxygen"></a-input>
        </div>
    </div>
    <div class="input-group" style="justify-content: center">
        <a-button type="primary" @click="submit">提交</a-button>
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue";
import * as request from "../api/request"
import {lesson,project,mission,sensorThes} from "../store/index.js"
// let lesson  = ref(1);
// let project = ref(3);
// let mission = ref(1);
// let sensorThes = ref({
//     temp: 0,
//     humi: 0,
//     pm25: 0,
//     voc: 0,
//     pressure: 0,
//     oxygen: 0
// });



function submit(){
    request.post("/user/setlesson",{
        lesson:lesson.value,
        project:project.value,
        mission:mission.value,
        sensorThes:sensorThes.value
    })
    .then(()=>{
        alert("设置成功");
    })
    .catch(res=>{
        console.log(res.response.data);
        alert(JSON.stringify(res.response.data));
    });
}

</script>

<style scoped>

.page-cont {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 18px;
}

.page-cont input{
    font-size: 18px;
}

.input-group {
    width: 80%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.input-group>div{
    width: 30%;
}
</style>